package com.tianyadu.multi_module_demo.service.imp;

import com.tianyadu.multi_module_demo.domain.ProductInfo;
import com.tianyadu.multi_module_demo.repository.ProductInfoRepository;
import com.tianyadu.multi_module_demo.service.ProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @FileName: ProductInfoServiceImpl
 * @Description:
 * @author: xueyj
 * @create: 2018-11-24 09:48
 */
@Service
public class ProductInfoServiceImpl implements ProductInfoService {

    @Autowired
    private ProductInfoRepository repository;

    /**
     * @Description: 查询所有在架商品信息
     * @param:
     * @return:
     * @author:
     * @date: 2018/11/20 18:09
     */
    @Override
    public List<ProductInfo> findAllUp() {
        return repository.findByProductStatus(0);
    }

    /**
     * @param productIds
     * @Description: 根据商品id查询商品信息
     * @param: List<String> productIds-->商品idlist
     * @return:
     * @author:
     * @date: 2018/11/20 18:09
     */
    @Override
    public List<ProductInfo> findProductByIds(List<String> productIds) {
        return repository.findByProductIdIn(productIds);
    }

}